<template>
  <div id="app">
    <h1>根组件</h1>
    <div>state中的count数据: {{ $store.state.count }}</div>
    <div>计算属性的方式 - state中的count数据: {{ count }}</div>
    <input type="text">
    <Son1></Son1>
    <hr>
    <Son2></Son2>
  </div>
</template>

<script>
import Son1 from './components/Son1.vue'
import Son2 from './components/Son2.vue'
import { mapState } from 'vuex'

export default {
  name: 'App',
  data: function () {
    return {

    }
  },
  computed: {
    ...mapState(['count'])
    // count () {
    //   return this.$store.state.count
    // }
  },
  components: {
    Son1,
    Son2
  }
}
</script>

<style>
#app {
  width: 600px;
  margin: 20px auto;
  border: 3px solid #ccc;
  border-radius: 3px;
  padding: 10px;
}
</style>
